package org.xdemo.example.remoteUI.entity;

import java.util.ArrayList;
import java.util.Random;

/**
 * Created by kz on 2017/8/17.
 */
public class tHiDeviceParas {

    public String DeviceName;

    public ArrayList<tOneGroup> groups;

    public ArrayList<tOneGroup> getGroups() {
        for (int i = 0; i < groups.size(); i++) {
            tOneGroup group = groups.get(i);
            for (int j = 0; j < group.addrCount() ; j++) {
                tOneAddress address = group.addresses.get(j);
                address.valStr = new Random().nextInt(4000) + "";
            }
        }
        return groups;
    }

    public void setGroups(ArrayList<tOneGroup> groups) {
        this.groups = groups;
    }

    public tHiDeviceParas(){
        groups =  new ArrayList<tOneGroup>();
    }
    public tHiDeviceParas(String name){
        this();
        this.DeviceName = name;
    }

    public int groupCount() {
        return groups.size();
    }

    public boolean addOneGroup(tOneGroup group) {
        if(this.groups != null) {
            groups.add(group);
        }
        return true;
    }

}
